/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.informet.ipd.struts.action;

import com.informet.ipd.modelo.dao.AdarDao;
import com.informet.ipd.modelo.dao.CearAlumnoDao;
import com.informet.ipd.modelo.dao.CearAlumnoMPDao;
import com.informet.ipd.modelo.dao.ProgEstrDao;
import com.informet.ipd.modelo.dao.TalentoDao;
import com.informet.ipd.struts.form.AdarForm;
import com.informet.ipd.struts.form.CearForm;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.swing.JOptionPane;
import org.apache.struts.actions.DispatchAction;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionForward;

/**
 *
 * @author Fiorella
 */
public class AdarAction extends DispatchAction{


    public ActionForward load(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response)
            throws Exception {

       AdarForm form1 = (AdarForm) form;
       List listRegion=null;
       
       
        try
        {
          listRegion=new ProgEstrDao().getRegion();          
          form1.setListRegion(listRegion);        }
        catch(Exception e)
        {
           JOptionPane.showMessageDialog(null, e);
        }

         return mapping.findForward("adarPlanificacion");
    }

    public ActionForward listarAlumnos(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response)
            throws Exception {

        AdarForm form1 = (AdarForm) form;
                
                String AnioInicio=request.getParameter("AnioInicio");
                String codAdar=request.getParameter("codAdar");
                String descEstadio=request.getParameter("descEstadio");

        //  form1.setCordinadorTecnico(cordinadorTecnico);
          form1.setCodAdar(codAdar);
          form1.setAnioInicio(AnioInicio);
          form1.setDescEstadio(descEstadio);
          //form1.setCodDisciplina(codDisciplina)
          //List listAdararAlumnos=new AdarDao().getListAlumno(codCear, "","", "","", "-1","-1", "-1","");
          //form1.setListCearAlumnos(listAdararAlumnos);

         return mapping.findForward("adarPlanificacionAlumno");
    }

     public ActionForward listarMarcaPersonal(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response)
            throws Exception {

         AdarForm form1 = (AdarForm) form;
         
         String codAdar=request.getParameter("codAdar");         
         String codAlumno=request.getParameter("codAlumno");
         String codDisciplina=request.getParameter("codDisciplina");
         String nombre=request.getParameter("nombre")+" "+request.getParameter("apePaterno")+" "+request.getParameter("apeMaterno");

         
         form1.setCodAdar(codAdar);         
         form1.setCodAlumno(codAlumno);
         form1.setNomAlumno(nombre);
          
         // List listPrueba=new CearAlumnoDao().getlistPrueba(null, codDisciplina);

       //   form1.setListPrueba(listPrueba);
         
          return mapping.findForward("adarPlanificacionAlumnoMP");
    
    }


    public ActionForward listarExpectativa(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response)
            throws Exception {

          AdarForm form1 = (AdarForm) form;
         
          String codAdar=request.getParameter("codAdar");
          String codAlumno=request.getParameter("codAlumno");          
          String nombre=request.getParameter("nombre")+" "+request.getParameter("apePaterno")+" "+request.getParameter("apeMaterno");
          
          form1.setCodAdar(codAdar);
          form1.setCodAlumno(codAlumno);
          form1.setNomAlumno(nombre);
          return mapping.findForward("adarPlanificacionAlumnoEx");

    }


    //Ini Monitoreo

    public ActionForward loadMonitoreo(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response)
            throws Exception {

      AdarForm form1 = (AdarForm) form;
       List listRegion=null;
       List disciplinas=null;
       form1.setFlagMeCcd("1");
        try
        {
          listRegion=new ProgEstrDao().getRegion();
          disciplinas=new TalentoDao().getlistDisciplina(null, null);

          form1.setListRegion(listRegion);
          form1.setListDisciplina(disciplinas);
          form1.setCodDisciplina(Integer.parseInt("-1"));
        }
        catch(Exception e)
        {
           JOptionPane.showMessageDialog(null, e);
        }

         return mapping.findForward("adarPlanificacionMo");
    }

    public ActionForward listarAlumnosMo(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response)
            throws Exception {

          AdarForm form1 = (AdarForm) form;

                String AnioInicio=request.getParameter("AnioInicio");
                String codAdar=request.getParameter("codAdar");
                String descEstadio=request.getParameter("descEstadio");

        //  form1.setCordinadorTecnico(cordinadorTecnico);
          form1.setCodAdar(codAdar);
          form1.setAnioInicio(AnioInicio);
          form1.setDescEstadio(descEstadio);
          //form1.setCodDisciplina(codDisciplina)
          //List listAdararAlumnos=new AdarDao().getListAlumno(codCear, "","", "","", "-1","-1", "-1","");
          //form1.setListCearAlumnos(listAdararAlumnos);

         return mapping.findForward("adarPlanificacionAlumnoMo");
    }

    public ActionForward listarExpectativaMo(ActionMapping mapping, ActionForm form,
            HttpServletRequest request, HttpServletResponse response)
            throws Exception {

        AdarForm form1 = (AdarForm) form;

          String codAdar=request.getParameter("codAdar");
          String codAlumno=request.getParameter("codAlumno");
          String codCausaRetiro=request.getParameter("codCausaRetiro");
          String nombre=request.getParameter("nombre")+" "+request.getParameter("apePaterno")+" "+request.getParameter("apeMaterno");

          form1.setCodAdar(codAdar);
          form1.setCodAlumno(codAlumno);
          form1.setNomAlumno(nombre);
          form1.setCodCausaRetiro(codCausaRetiro);
          List listCausaRet=new AdarDao().getListCausaRetiro(null, null);
          form1.setListEtiquetas(listCausaRet);
          return mapping.findForward("adarMonitoreoResultados");
    }

}
